Scene Api
Functions
Applies the contents of the given template scene to the currently loaded scene. This loads the template scene while keeping the design unit and page dimensions of the current scene. The content of the pages is automatically adjusted to fit the new dimensions.
Create a new scene, along with its own camera.
Create a new scene with explicit design and font-size units.
Create a new scene in video mode, along with its own camera.
Loads the given image and creates a scene with a single page showing the image. Fetching the image may take an arbitrary amount of time, so the scene isn't immediately available.
Loads the given video and creates a scene with a single page showing the video. Fetching the video may take an arbitrary amount of time, so the scene isn't immediately available.
Disables any previously set position clamping for the current scene.
Disables previously set zoom clamping for the current scene.
Disables any previously set zoom auto-fit.
Continually ensures the camera position to be within the width and height of the blocks axis-aligned bounding box. Without padding, this results in a tight clamp on the blocks. Disables any previously set camera position clamping in the scene and also takes priority over clamp camera commands.
Continually ensures the zoom level of the camera in the active scene to be in the given range.
Continually adjusts the zoom level to fit the width or height of a block's axis-aligned bounding box. This only shows an effect if the zoom level is not handled/overwritten by the UI. Without padding, this results in a tight view on the block. No more than one block per scene can have zoom auto-fit enabled. Calling setZoomLevel or zoomToBlock disables the continuous adjustment.
Finds all blocks with the given kind sorted by distance to viewport center.
Finds all blocks with the given type sorted by distance to viewport center.
Return the currently active scene.
Get the current page, i.e., the page of the first selected element if this page is at least 25% visible or, otherwise, the page nearest to the viewport center.
Returns the design unit of the current scene.
Returns the font-size unit of the current scene.
Get the current scene layout.
Get the sorted list of pages in the scene.
Get the zoom level of the scene or for a camera in the scene. Returns the current zoom level of the scene in unit dpx/dot. A zoom level of 2F results in one dot in the design to be two pixels on the screen.
Sets the zoom and focus to show a block. This only shows an effect if the zoom level is not handled/overwritten by the UI. Without padding, this results in a tight view on the block. It is set immediately and assumes that the block dimensions are known. The block should not be in pending state and it's layout should be up to date.
Queries whether position clamping is enabled for blockOrScene.
Queries whether zoom clamping is enabled.
Queries whether zoom auto-fit is enabled for block.
Load a scene from the resource of a scene or archive file. The file will be fetched asynchronously by the engine and loaded as an archive or as a scene file depending on its content. This loads .imgly files as well as the legacy .scene and .zip formats.
Load the contents of a scene file.
Load the contents of a scene previously saved as an archive.
Subscribe to changes to be called whenever the active scene changes. This may happen upon scene load or creation of a new scene.
Subscribe to changes to the zoom level.
Saves the current scene and all of its referenced assets into an archive. The archive contains all assets, that were accessible when this function was called. Blocks in the archived scene reference assets relative from to the location of the scene file. These references are resolved when loading such a scene via load.
Serializes the current scene into a string. Selection is discarded. If a resource uri has a scheme that is not in allowedResourceSchemes, an exception will be thrown.
Serializes the current scene into a string with optional compression. Selection is discarded. If a resource uri has a scheme that is not in options.allowedResourceSchemes, an exception will be thrown.
Converts all values of the current scene into the given design unit.
Sets the unit in which font sizes for BlockApi.setTextFontSize / BlockApi.getTextFontSizes are interpreted. The engine continues to store font sizes in points internally; this only affects API-boundary interpretation.
Set the scene layout. This will handle all necessary conversions including creating or destroying stack blocks and reparenting pages as needed. When transitioning from stack layouts (VerticalStack, HorizontalStack, DepthStack) to Free layout, the global positions of pages are preserved to maintain their visual appearance in the scene.
Set the zoom level of the scene, e.g., for headless versions. This only shows an effect if the zoom level is not handled/overwritten by the UI. Setting a zoom level of 2F results in one dot in the design to be two pixels on the screen.
Sets the zoom and focus to show a block. Without padding, this results in a tight view on the block. It is set asynchronous to ensure that the block dimensions are known.